#ifndef __BLACK_VALID_H__
#define __BLACK_VALID_H__

#include "maths/default.h"
#include <assert.h>

namespace black
{
#if defined( bMVISUAL )
# include <float.h>
	bFORCEINLINE bool isNan( const float x )		{ return _isnan( x ) != 0; }
	bFORCEINLINE bool isInf( const float x )		{ return _finite( x ) == 0; }
	bFORCEINLINE bool isFinite( const float x )		{ return _finite( x ) != 0; }
	bFORCEINLINE bool isValid( const float x )		{ return !isNan( x ) && isFinite( x ); }
#elif defined( bGCC )
# include <math.h>
    bFORCEINLINE bool isNan( const float x )		{ return _isnan( x ) != 0; }
	bFORCEINLINE bool isInf( const float x )		{ return _finite( x ) == 0; }
	bFORCEINLINE bool isFinite( const float x )		{ return _finite( x ) != 0; }
	bFORCEINLINE bool isValid( const float x )		{ return !isNan( x ) && isFinite( x ); }
#else
	bFORCEINLINE bool isNan( const float x )		{ return x != x; }
	bFORCEINLINE bool isInf( const float x )		{ return x != x; }
	bFORCEINLINE bool isFinite( const float x )		{ return x == x; }
	bFORCEINLINE bool isValid( const float x )		{ return !isNan( x ) && isFinite( x ); }
#endif

	extern const float F_NAN;
	extern const float F_INF;

#ifdef bDEBUG
# define bASSERT( x ) assert( x );
#else
# define bASSERT( x )
#endif

#if defined( bDEBUG ) && defined( bUSE_LIGHT_ASSERT )
# define bLIGHT_ASSERT( x )	assert( x );
#else
# define bLIGHT_ASSERT( x )
#endif

#if (_MSC_VER >= 1300)
# define assertAligned( x, uiCount ) assert( __alignof(x) == uiCount );
#elif defined( bGCC )
# define assertAligned( x, uiCount ) assert( __alignof__(x) == uiCount );
#else
# define assertAligned( x, uiCount ) 
#endif

#define assertAligned16Ptr( x ) assert( (((unsigned long)(x))&15) == 0 );
}

#endif // __BLACK_VALID_H__
//---------------------------------------------------------------------------------------
// Copyright (c) 2009 Jounayd Id Salah.
// All rights reserved.
//---------------------------------------------------------------------------------------
